<template>
  <div class="dashboard-container">
  <div class="dashboard-text">学号：1903010304 </div>
  <div class="dashboard-text">姓名：陈廷轩</div>
  <div style="font-size: 20px;text-align: center;">你创建的学校数：{{schools}}</div>
  <div style="font-size: 20px;text-align: center;">你创建的学院数：{{academys}}</div>
  <div style="font-size: 20px;text-align: center;">你创建的班级数：{{classs}}</div>
  <div style="font-size: 20px;text-align: center;">你创建的学生数：{{students}}</div>
  <div style="font-size: 20px;text-align: center;">你创建的教师数：{{teachers}}</div>
  </div>
</template>
<script>
  import { mapGetters } from 'vuex'

  export default {
    name: 'Dashboard',
    data(){
        return{
          schools:0,
          academys:0,
          classs:0,
          students:0,
          teachers:0
        }
    },
    computed: {
      ...mapGetters([
        'name'
      ])
    },
    mounted(){
      this.$http.get('/api/users/add').then(res => {
        console.log('this.panels', res)
      })
           this.$http.post('/api/school/find').then(res => {
        if(res&&res.length>0){
          this.schools = res.length
          console.log('res:', res)
        }
      })
           this.$http.post('/api/academy/find').then(res => {
        if(res&&res.length>0){
          this.academys = res.length
          console.log('res:', res)
    }
      })
           this.$http.post('/api/classs/find').then(res => {
        if(res&&res.length>0){
          this.classs = res.length
          console.log('res:', res)
    }
      })
           this.$http.post('/api/student/find').then(res => {
        if(res&&res.length>0){
          this.students = res.length
          console.log('res:', res)
    }
      })
           this.$http.post('/api/teacher/find').then(res => {
        if(res&&res.length>0){
          this.teachers = res.length
          console.log('res:', res)
    }
      })
    }
  }
  </script>
<style lang="scss" scoped>
  .dashboard {
    &-container {
      margin: 30px;
      ;
    }
    &-text {
      font-size: 30px;
      color: royalblue;
      line-height: 46px;
    }
  }</style>
